<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<script type="text/javascript" src="scripts/actions.js"></script>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Jogo da Forca</title>

</head>
<body>
	<h1>Digite seu Nome e escolha o nivel que deseja jogar</h1>
	
	<form id="frmPrincipalForca" name="frmPrincipalForca" method="post" action="">
		<table>
			<tr>
				<td>Nome</td>
				<td><input type="text" name="txtNome" id="txtPalavra"
					size="50"/></td>
			</tr>
			<tr>
				<td>Nivel</td>
				<td><select id="txtNivel" name="txtNivel">
						<option value="">Selecione</option>
						<option value="BASICO">Basico</option>
						<option value="MEDIO">Medio</option>
						<option value="AVANCADO">Avancado</option>
				</select></td>
			</tr>
			<tr>
				<td colspan="2"><input type="button" value="Continuar"
					onClick="javascript:validar('abrirJogoForca')" /></td>
			</tr>
			<tr>
				<td colspan="2"><input type="button" value="Voltar"
					onClick="javascript:voltar('voltarPrincipal')" /></td>
			</tr>
		</table>
	</form>
	<script>
	function validar(paramAcao) {
		var nome = document.frmPrincipalForca.txtNome.value;
		var nivel = document.frmPrincipalForca.txtNivel.value;
		
		if (nome != "" && nivel != "")
		{
			document.frmPrincipalForca.action="<%=request.getContextPath()%>/ForcaServlet?acao="+ paramAcao;
			document.frmPrincipalForca.submit();
		} else

		if (nome == "") {
			alert("Favor preencher NOME !");
		} else if (nivel == "") {
			alert("Favor escolher NIVEL !");
		}

	}
	function voltar(paramAcao) {
		document.frmPrincipalForca.action="<%=request.getContextPath()%>/ForcaServlet?acao="+ paramAcao;
		document.frmPrincipalForca.submit();
	}
</script>
</body>
</html>